package com.ruoyi.common.DataConversion;

import com.ruoyi.common.domin.TypeConvertUtils;
import struct.StructClass;
import struct.StructField;

/**
 * @ClassName DownNewPackageHeader
 * @Description 下行包包头
 * @Author 张勇
 * @Date 2024-10-10
 * @Version 1.0.0.0
 **/
@StructClass
public class DownNewPackageHeader {
    /**
     * 包头
     */
    @StructField(order = 0)
    public byte[] packageHeader=new byte[4];

    /**
     * 包类型
     */
    @StructField(order = 1)
    public byte[] packageType=new byte[1];

    /**
     * 包长度
     */
    @StructField(order = 2)
    public byte[] packageBodyLength=new byte[2];


    /**
     * 设置包头
     * @param packageHeader
     */
    public void setPackageHeader(byte[] packageHeader) {
        this.packageHeader = packageHeader;
    }

    /**
     * 设置包类型
     * @param packageType
     */
    public void setPackageType(String packageType) {
        this.packageType = TypeConvertUtils.stringToBytes(packageType);
    }

    /**
     * 设置包长度
     * @param packageBodyLength
     */
    public void setPackageBodyLength(Integer packageBodyLength) {
        this.packageBodyLength = TypeConvertUtils.intToConverseBytes(packageBodyLength,2);


    }

}
